<div class="main_top">
	<ul class="pagenavi">
		<li><a href="/">首页</a></li>
		<li class="li2"><a href="/my/">我的主页</a></li>
		<li class="li2">修改信息</li>
	</ul>
</div>
<div class="clear"></div>
<div class="clear"></div>
<!--main top end -->
{{include file="mypage_left.tpl"}}
<div class="main_right">
	<h2>修改信息</h2>
	<div class="main_content">
	<form name="mainform" action="myinfo.php" method="post" enctype="multipart/form-data">
		<input type="hidden" name="hid_password" value="{{$password}}">
		<input type="hidden" name="user_id" value="{{$user_id}}">
		<input type="hidden" name="grade" value="{{$grade}}">
		<input type="hidden" name="cmd" value="">
		<table cellpadding="0" cellspacing="0" width="100%" class="info">
			<tr>
				<td class="cont_1">头像</td>
				<td class="cont_2"><img src="{{$faceImg}}"/><br/><input type="file" name="faceImg" size="15px;"></td>
			</tr>
			<tr>
				<td class="cont_1">用户名</td>
				<td class="cont_2">{{$user_name}}</td>
			</tr>
			<tr>
				<td class="cont_1">Email</td>
				<td class="cont_2">{{$email}}<input type="hidden" name="email" value="{{$email}}"></td>
			</tr>
			<tr>
				<td class="cont_1"><span class="title">密&nbsp;码：</span></td>
				<td class="cont_2"><input type="password" name="password" id="password" value="{{$password}}" class="text" maxlength="30" style="ime-mode:disabled" tabindex="3" onfocus="this.value=''">
					<span id='passwordmsg' class="error">{{$systemMsg.password}}</span>
				</td>
			</tr>
			<tr>
				<td class="cont_1"><span class="title">确认密码：</span></td>
				<td class="cont_2"><input type="password" name="password_again" id="password_again" value="{{$password_again}}" class="text" maxlength="30" style="ime-mode:disabled" tabindex="4" onfocus="this.value=''">
					<span id='password_againmsg' class="error">{{$systemMsg.password_again}}</span>
				</td>
			</tr>
			<tr>
				<td colspan="2" align="center"><input type="image" src="/images/save.gif" onclick="document.mainform.cmd.value='confirm'" tabindex="5"/>
				</td>
			</tr>
		</table>
	</form>
	</div>
</div>
<!--main_right end -->
<div class="clear"></div>
</div>
<!--main end -->
<script type="text/javascript" src="/script/jquery.js"></script>
<script type="text/javascript" src="/script/common.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function(){	
	$("input").focus(function(){
		var id=$(this).attr('id');
		$("#"+id+"msg").removeClass().html("");
	});

    $("input").blur(function(){ 
		var id=$(this).attr('id');
		var checkFun="";
		var addUrl="";
		switch(id){
			case 'user_name':checkFun="checkUserName";break;
			case 'email':checkFun="ajaxCheckEmail";break;
			case 'password':checkFun="ajaxCheckPassword";break;
			case 'password_again':checkFun="ajaxCheckPasswordAgain";
								  addUrl="&password="+$("#password").val();
								  break;
		}
		if(checkFun=="")return;
    	var input=$(this).val();
    	if(input != ''){
    		$.ajax({
		        type:"POST",
		        url:"regist.php?cmd="+checkFun+"&"+id+"="+input+addUrl,
		        success:function(msg){
					if(msg=='1'){
						$("#"+id+"msg").removeClass().addClass("error").html("<input type=\"image\" src=\"images/msg_ok.png\">");
					}else{
						$("#"+id+"msg").removeClass().addClass("error").html(msg);
					}
		        }            
		     });
    	}
    });
});
</script>